package com.service;

import com.config.RibbitMQConfig;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MQService {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void sendTestMessage()
    {
        //交换机，key,消息内容
        rabbitTemplate.convertAndSend(RibbitMQConfig.MIAOSHA_EXCHANGE, RibbitMQConfig.KEY_MIAOSHA,"测试" );
    }
}
